Les annonces peuvent être obtenues à partir des sites divers. Dans le fichier annonces.csv, des informations concernant des annonces de Clio 2 ont été stockées sous forme de tableau.
data=read.csv2("annonces.csv")
data=data.table(data)
head(data)
## X version_annonce departement typeseller year mileage
## 1: 1 II 1.4 RTE 5P 25 Particulier 2000 228081
## 2: 2 II (2) 1.4 16S PRIVILEGE 5P 91 Particulier 2001 134000
## 3: 3 II 1.9 D RTE 5P 80 Professionnel 2000 253292
## 4: 4 II (2) 1.2 16S AUTHENTIQUE 5P 55 Professionnel 2002 132940
## 5: 5 II (2) 1.5 DCI 65 BILLABONG 3P 45 Professionnel 2003 92000
## 6: 6 II 1.9 DTI RXE 3P 60 Professionnel 2000 225000
## price
## 1: 1500
## 2: 2800
## 3: 2290
## 4: 3200
## 5: 3990
## 6: 1990
Il est possible d’obtenir plus d’informations à partir des versions. Par exemple, on peut voir qu’il y a le nombre de portes. Il est également possible d’étudier certaines versions (Authentique, Expression, Privilège, etc.).
## X version_annonce departement typeseller year mileage
## 1: 1 II 1.4 RTE 5P 25 Particulier 2000 228081
## 2: 2 II (2) 1.4 16S PRIVILEGE 5P 91 Particulier 2001 134000
## 3: 3 II 1.9 D RTE 5P 80 Professionnel 2000 253292
## 4: 4 II (2) 1.2 16S AUTHENTIQUE 5P 55 Professionnel 2002 132940
## 5: 5 II (2) 1.5 DCI 65 BILLABONG 3P 45 Professionnel 2003 92000
## 6: 6 II 1.9 DTI RXE 3P 60 Professionnel 2000 225000
## price nbp
## 1: 1500 5
## 2: 2800 5
## 3: 2290 5
## 4: 3200 5
## 5: 3990 3
## 6: 1990 3
## Classes 'data.table' and 'data.frame': 515 obs. of 8 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ version_annonce: Factor w/ 148 levels "II (2) 1.2 16S 75 CONFORT DYNAMIQUE 3P",..: 119 42 140 6 50 145 85 10 3 79 ...
## $ departement : int 25 91 80 55 45 60 42 93 91 86 ...
## $ typeseller : Factor w/ 2 levels "Particulier",..: 1 1 2 2 2 2 2 2 2 2 ...
## $ year : int 2000 2001 2000 2002 2003 2000 2002 2003 2005 2003 ...
## $ mileage : num 228081 134000 253292 132940 92000 ...
## $ price : int 1500 2800 2290 3200 3990 1990 2850 2995 3490 3400 ...
## $ nbp : Factor w/ 2 levels "3","5": 2 2 2 2 1 1 1 2 2 2 ...
## - attr(*, ".internal.selfref")=<externalptr>
Les prix dépendent des années de commercialisation (qui peuvent être considérées comme l’âge de véhicule).
p <- ggplot(data, aes(year,price,colour=typeseller))+
geom_jitter()
p
En utilisant plotly, on peut rendre le graphique interactif.
ggplotly(p)
On peut voir si le type de vendeurs (particuliers ou professionnels) impactent le prix de véhicule.
p <- ggplot(data, aes(year,price,group=typeseller,colour=typeseller))+
geom_jitter(data=data,aes(shape=nbp,labels=version_annonce))+
geom_smooth(alpha=0.25)
p
Comme on voit qu’il y a un impact, on peut voir les deux distributions :
p=ggplot(data, aes(x=price)) +
geom_density(aes(group=typeseller, colour=typeseller))+
ggtitle("Distribution des prix en fonction du type de vendeurs")
p
p <- ggplot(data, aes(year,price,group=nbp,colour=nbp))+
geom_jitter(data=data,aes(shape=nbp,labels=version_annonce))+
geom_smooth(alpha=0.25)
p
p <- ggplot(data, aes(mileage,price,group=typeseller,colour=typeseller))+
geom_jitter(data=data,aes(size=price,labels=version_annonce))+
geom_smooth(alpha=0.25)
p
p <- ggplot(data, aes(year,mileage,group=typeseller,colour=typeseller))+
geom_jitter(data=data,aes(size=price,labels=version_annonce))+
geom_smooth(alpha=0.25)
p